package com.sskj.level.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.level.bean.ContractNoteBean;
import com.sskj.level.ui.fragment.DealFragment;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;


public class DealFragmentPresenter extends BasePresenter<DealFragment> {



    public Flowable<List<ContractNoteBean>> getData(String page, String pageSize,String stockCode) {
        return httpService.getChengjiao(page, pageSize,stockCode)
                .converter(new JsonConverter<HttpData<PageBean<ContractNoteBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList())
                .onErrorReturn(throwable -> new ArrayList<>())
                ;
    }



}
